<template>
	<view class="app">
		<u-navbar :custom-back="fanhui" :background="background"></u-navbar>
		<view class="a-title">免费专业咨询</view>


		<view class="center" v-for="(item, index) in freeDoctorList" :key="index"
			@click="navTo(`/pages/doctor/info?id=${item.id}`)">
			<view class="mfzx row center">
				<view>
					<image class="mfzx-img " :src="item.img"></image>
				</view>

				<view class="tech-z">
					<view class="space-between tech-name-info">
						<view class="tech-name">{{item.name}}</view>
						<view class="mxfx-wz center">
							免费咨询
						</view>
					</view>
					<view class="tech-info">{{item.introduce}}</view>
				</view>
			</view>
		</view>



		<view class="a-title">专家咨询</view>

		<view class="center" v-for="(itemt, indext) in doctorList" :key="'info2-'+indext"
			@click="navTo(`/pages/doctor/info?id=${itemt.id}`)">

			<view class="mfzx row center">
				<view>
					<image class="mfzx-img " :src="itemt.img"></image>
				</view>

				<view class="tech-z">
					<view class="space-between tech-name-info">
						<view class="tech-name">{{itemt.name}}</view>
						<view class="mxfx-wz center">
							咨询
						</view>
					</view>
					<view class="tech-info">{{itemt.introduce}}</view>
				</view>
			</view>
		</view>




	</view>
</template>

<script>
	import dapi from '@/api/doctor.js'
	export default {
		data() {
			return {
				background: {
					backgroundColor: '#A564C3',
				},
				freeDoctorList: [], //免费专业咨询
				doctorList: [], //专家咨询1
			}
		},
		async onLoad() {
			this.loadDoctorData()
		},

		onNavigationBarButtonTap(e) {
			console.log(this)
			console.log(this.$mp)
			uni.switchTab({
				url: '/pages/index/index'
			})
			// uni.navigateBack({
			//     delta: 2
			// });
			// history.back(2)
			// this.$router.history.go(-1)
		},
		methods: {
			fanhui(){
				uni.switchTab({
					url: '/pages/index/index'
				})
			},
			// 首页 专家列表
			async loadDoctorData() {
				const {
					data
				} = await dapi.getHomeList()

				this.freeDoctorList = data[0]
				this.doctorList = data[1]

			}
		},

	}
</script>

<style lang="scss">
	.a-title {
		margin-top: 30rpx;
		margin-left: 30rpx;

		width: 300rpx;
		height: 37rpx;
		font-size: 36rpx;
		font-family: Microsoft YaHei;
		font-weight: bold;
		color: #333333;
	}

	.mfzx {
		align-items: center;

		margin-top: 50rpx;
		width: 690rpx;
		height: 180rpx;
		background: #FFFFFF;
		box-shadow: 0px 2rpx 31rpx 1rpx rgba(227, 225, 229, 0.4);
		border-radius: 20rpx;

		.mfzx-img {
			height: 120rpx;
			width: 120rpx;
			margin-left: 30rpx;
			border-radius: 50%;

		}

		.tech-z {
			// background-color: #005CC5;
			height: 120rpx;
			width: 481rpx;
			margin-left: 30rpx;
		}

		.tech-name-info {

			// height: 120rpx;
			// width: 481rpx;
			// background-color: #005CC5;
			.tech-name {
				width: 98rpx;
				height: 33rpx;
				font-size: 32rpx;
				font-family: Microsoft YaHei;
				font-weight: bold;
				color: #333333;
			}

			.mxfx-wz {
				width: 130rpx;
				height: 46rpx;
				background: linear-gradient(90deg, #BB73D5, #643A92);
				border-radius: 23rpx;
				font-size: 24rpx;

				font-family: Microsoft YaHei;
				font-weight: 400;
				color: #FFFFFF;
				line-height: 36rpx;

			}

		}

		.tech-info {
			margin-top: 18rpx;
			width: 481rpx;
			height: 60rpx;
			font-size: 22rpx;
			font-family: Microsoft YaHei;
			font-weight: 400;
			color: #999999;
			line-height: 34rpx;

			// 显示两行，超出部分用...代替
			overflow: hidden; // 超出隐藏
			text-overflow: ellipsis; //超出部分显示省略号
			-webkit-line-clamp: 2; //设置显示的行数
			display: -webkit-box; // 将对象作为弹性伸缩盒子模型显示
			-webkit-box-orient: vertical; // 设置或检索伸缩盒对象的子元素的排列方式 纵向
			white-space: normal; // 空白会被浏览器忽略
		}
	}
</style>
